﻿@inject NetCoreCMS.IServices.IShopService _shop
@{
    Layout = null;
    Sysconfig config = ViewData["config"] as Sysconfig;
    string action = ViewBag.action as string;
    List<Shop_Bills> billsList = ViewBag.billsList as List<Shop_Bills>;
    Users userModel = ViewBag.userModel as Users;
    Shop shop = ViewBag.shop as Shop;
}
<!DOCTYPE html>
<!--HTML5 doctype-->
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>奖金余额</title>
    <link rel="stylesheet" type="text/css" href="/mobile/css/style.css" />
    <script type="text/javascript" charset="utf-8" src="/mobile/js/zepto.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/mobile/js/weui.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/mobile/js/common.js"></script>
</head>

<body ontouchstart>
    <div class="page">
        <!--页面头部-->
        <div class="header">
            <a class="back" href="javascript:history.back();">
                <i class="iconfont icon-arrow-left"></i>
            </a>
            <h3>奖金余额</h3>
            <div class="right">
                <a class="weui-cell_access weui-cell_link" asp-area="Web" asp-controller="Usercenter" asp-action="Index" asp-route-act="index">
                    <i class="iconfont icon-user"></i>
                </a>
            </div>
        </div>
        <!--/页面头部-->

        <div class="page__bd">

            @if (action == "pay")
            {
                <!--账户充值-->
                <link rel="stylesheet" type="text/css" href="/mobile/css/validate.css" />
                <script type="text/javascript" charset="utf-8" src="/mobile/js/mvalidate.js"></script>
                <script type="text/javascript" charset="utf-8" src="/mobile/js/mvalidate-extend.js"></script>
                <script type="text/javascript">
                $(function () {
                    //初始化表单
                    AjaxInitForm('#payForm', '#btnSubmit', 0);
                    //选中TAB样式
                    $(".weui-tabbar a").eq(1).addClass("weui-bar__item_on");
                });
                </script>
                <form id="payForm" name="payForm" class="form-box" url="/submit_ajax?action=user_cash_pay">
                    <div class="weui-form-preview" style="margin-top:10px;">
                        <div class="weui-form-preview__hd">
                            <div class="weui-form-preview__item">
                                <label class="weui-form-preview__label">收款方</label>
                                <em class="weui-form-preview__value">@shop.shopname</em>
                            </div>
                        </div>
                        <div class="weui-form-preview__hd">
                            <div class="weui-form-preview__item">
                                <label class="weui-form-preview__label">奖金余额</label>
                                <em class="weui-form-preview__value">¥@userModel.cash_point</em>
                            </div>
                        </div>
                        <div class="weui-form-preview__hd">
                            <div class="weui-form-preview__item">
                                <label class="weui-form-preview__label">重消余额</label>
                                <em class="weui-form-preview__value">¥@userModel.shop_point</em>
                            </div>
                        </div>
                    </div>

                    <div class="weui-panel weui-panel_access">
                        <div class="weui-panel__hd">支付金额</div>
                        <div class="weui-panel__bd">
                            <div class="weui-cells_form form-box">
                                <div class="weui-cell">
                                    <div class="weui-cell__hd">
                                        <label class="weui-label">支付金额</label>
                                    </div>
                                    <div class="weui-cell__bd">
                                        <input id="order_amount" name="order_amount" type="text" class="weui-input" placeholder="请输入金额" data-validate="n" style="font-size:large" />
                                        <input id="shop_id" name="shop_id" type="hidden" value="@shop.id" />
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="weui-panel weui-panel_access">
                        <div class="weui-panel__hd">支付方式</div>
                        <div class="weui-panel__bd">
                            <div class="weui-cells_radio form-box">
                                <!--取得一个DataTable-->
                                <label class="weui-cell weui-check__label" for="p-1">
                                    <div class="weui-cell__bd">
                                        <p>奖金支付</p>
                                    </div>
                                    <div class="weui-cell__ft">
                                        <input id="p-1" name="payment_id" type="radio" class="weui-check" value="1" data-validate="select" />
                                        <span class="weui-icon-checked"></span>
                                    </div>
                                </label>
                                <label class="weui-cell weui-check__label" for="p-2">
                                    <div class="weui-cell__bd">
                                        <p>重消支付</p>
                                    </div>
                                    <div class="weui-cell__ft">
                                        <input id="p-2" name="payment_id" type="radio" class="weui-check" value="2" data-validate="select" />
                                        <span class="weui-icon-checked"></span>
                                    </div>
                                </label>
                            </div>
                        </div>
                    </div>

                    <div class="weui-btn-area">
                        <input id="btnSubmit" name="btnSubmit" type="submit" class="weui-btn weui-btn_primary" value="确认支付" />
                    </div>
                </form>
                <!--账户充值-->
            }
            else if (action == "conversion")
            {
                <!--积分兑换-->
                <link rel="stylesheet" type="text/css" href="/mobile/css/validate.css" />
                <script type="text/javascript" charset="utf-8" src="/mobile/js/mvalidate.js"></script>
                <script type="text/javascript" charset="utf-8" src="/mobile/js/mvalidate-extend.js"></script>
                <script type="text/javascript">
                    $(function () {
                        //初始化表单
                        AjaxInitForm('#pointForm', '#btnSubmit', 1, '#turl');
                        //选中TAB样式
                        $(".weui-tabbar a").eq(2).addClass("weui-bar__item_on");
                    });
                </script>

                <input id="hideAmount" name="hideAmount" type="hidden" value="@userModel.amount" />
                <form id="pointForm" name="pointform" class="form-box" url="/submit_ajax/index?action=user_point_conversion">
                    <div class="weui-form-preview" style="margin-top:10px;">
                        <div class="weui-form-preview__hd">
                            <div class="weui-form-preview__item">
                                <label class="weui-form-preview__label">商城余额</label>
                                <em class="weui-form-preview__value">¥@userModel.amount</em>
                            </div>
                        </div>
                        <div class="weui-form-preview__hd">
                            <div class="weui-form-preview__item">
                                <label class="weui-form-preview__label">奖金余额</label>
                                <em class="weui-form-preview__value">¥@userModel.cash_point</em>
                            </div>
                        </div>
                        <div class="weui-form-preview__bd">
                            <div class="weui-form-preview__item">
                                <label class="weui-form-preview__label">重消余额</label>
                                <span class="weui-form-preview__value">@userModel.shop_point 元</span>
                            </div>

                            @if (userModel.is_lock == 1)
                            {
                                <div class="weui-form-preview__item">
                                    <label class="weui-form-preview__label">温馨提示</label>
                                    <span class="weui-form-preview__value">目前你的转让功能已被关闭！</span>
                                </div>
                            }
                        </div>
                    </div>


                    @{
                        <div class="weui-panel weui-panel_access">
                            <div class="weui-panel__hd">转换</div>
                            <div class="weui-panel__bd">
                                <div class="weui-cells_form form-box">
                                    <div class="weui-cell">
                                        <div class="weui-cell__hd">
                                            <label class="weui-label">转换金额</label>
                                        </div>
                                        <div class="weui-cell__bd">
                                            <input id="point" name="point" type="text" class="weui-input" placeholder="请输入转换金额" data-validate="n" />
                                        </div>
                                    </div>

                                </div>
                            </div>
                        </div>

                        <div class="weui-panel weui-panel_access">
                            <div class="weui-panel__hd">转换类型</div>
                            <div class="weui-panel__bd">
                                <div class="weui-cells_radio form-box">
                                    <!--取得一个DataTable-->

                                    <label class="weui-cell weui-check__label" for="p-1">
                                        <div class="weui-cell__bd">
                                            <p>重消转商城</p>
                                        </div>
                                        <div class="weui-cell__ft">
                                            <input id="p-1" name="payment_id" type="radio" class="weui-check" value="1" data-validate="select" />
                                            <span class="weui-icon-checked"></span>
                                        </div>
                                    </label>

                                    <label class="weui-cell weui-check__label" for="p-2">
                                        <div class="weui-cell__bd">
                                            <p>奖金转商城</p>
                                        </div>
                                        <div class="weui-cell__ft">
                                            <input id="p-2" name="payment_id" type="radio" class="weui-check" value="2" data-validate="select" />
                                            <span class="weui-icon-checked"></span>
                                        </div>
                                    </label>

                                </div>
                            </div>
                        </div>


                        <div class="weui-btn-area">
                            <input id="btnSubmit" name="btnSubmit" type="submit" class="weui-btn weui-btn_primary" value="确认转换" />
                        </div>
                    }
                </form>
                <!--/积分兑换-->
            }
            else
            {
                <!--充值记录-->
                <script type="text/javascript">
                $(function () {
                    //选中TAB样式
                    $(".weui-tabbar a").eq(3).addClass("weui-bar__item_on");
                });
                //删除方法
                function ExecPostBack(checkValue) {
                    if (arguments.length == 1) {
                        ExecDelete('/submit_ajax?action=user_pay_delete', checkValue, '#turl');
                    } else {
                        var valueArr = '';
                        $("input[name='checkId']:checked").each(function (i) {
                            valueArr += $(this).val();
                            if (i < $("input[name='checkId']:checked").length - 1) {
                                valueArr += ","
                            }
                        });
                        ExecDelete('/submit_ajax?action=user_pay_delete', valueArr, '#turl');
                    }
                }
                </script>

                <div class="detail-list">
                    <ul>
                        <!--取得分页页码列表-->
                        @foreach (Shop_Bills dr in billsList)
                        {
                            <li>
                                <div class="detail-hd">
                                    <span class="fr">
                                        @_shop.GetModel(dr.shop_id).shopname
                                    </span>
                                    <span>@dr.add_time</span>
                                </div>
                                <div class="detail-bd">
                                    <div class="list-box">
                                        <div class="txt-box">
                                            <h2>订单号 @dr.remark</h2>
                                            <p class="note">
                                                <span class="fr">
                                                    ￥@dr.point
                                                </span>
                                                <span>@(dr.status)</span>
                                            </p>
                                        </div>
                                    </div>
                                </div>@*
                            <div class="detail-ft">
                                <div class="ft-btn">
                                    <div class="btn-box">
                                        <a href="javascript:;" onclick="ExecPostBack('@dr.id');">
                                            <i class="iconfont icon-delete"></i>
                                            删除
                                        </a>
                                    </div>
                                </div>
                            </div>*@
                            </li>
                        }
                        @if (billsList.Count == 0)
                        {
                            <div class="nodata">暂无记录...</div>
                        }
                    </ul>
                </div>

                <!--分页页码-->
                <div class="page-list">
                    @Html.Raw(ViewBag.pagelist)
                </div>
                <!--/分页页码-->

                <input id="turl" type="hidden" value="/Web/PayShop/Index?action=log" /><!--存在跳转的URL值-->
                <!--/充值记录-->
            }

        </div>

        <!--版权信息-->
        @await Html.PartialAsync("~/Areas/Web/Views/Shared/_Copyright.cshtml")
        <!--/版权信息-->
        <!--底部导航-->
        <div class="weui-tab foot-nav">
            <div class="weui-tab__panel">

            </div>
            <div class="weui-tabbar">
                <a asp-area="Web" asp-controller="Index" asp-action="Index" class="weui-tabbar__item">
                    <i class="iconfont icon-home weui-tabbar__icon"></i>
                    <p class="weui-tabbar__label">首页</p>
                </a>
                <a asp-area="Web" asp-controller="PayShop" asp-action="Index" asp-route-act="pay" class="weui-tabbar__item">
                    <i class="iconfont icon-money weui-tabbar__icon"></i>
                    <p class="weui-tabbar__label">付款</p>
                </a>
                <a asp-area="Web" asp-controller="PayShop" asp-action="Index" asp-route-act="conversion" class="weui-tabbar__item">
                    <i class="iconfont icon-point weui-tabbar__icon"></i>
                    <p class="weui-tabbar__label">转换</p>
                </a>
                <a asp-area="Web" asp-controller="PayShop" asp-action="Index" asp-route-act="log" class="weui-tabbar__item">
                    <i class="iconfont icon-amount weui-tabbar__icon"></i>
                    <p class="weui-tabbar__label">支付记录</p>
                </a>
            </div>
        </div>
        <!--/底部导航-->
    </div>
</body>
</html>
